{%include file="index.header.tpl.php"%}
{%include file="index.left.tpl.php"%}
  <!--主要内容开始-->
<div class="content-wrapper">
    <section class="content">
        <div class="row">
            <!--树状图-->
            <section class="col-lg-2 connectedSortable" style=" padding-right:0px; margin-bottom:10px;">
                <div class="sidebar" style="background-color:#fff; padding-bottom:0px;">
                    <ul class="sidebar-menu" id="chan">
                        {%foreach from=$grade_lists key=key item=value%}
                        <li class="treeview {%if $value.grade_id==$grade_id%}active{%/if%}">
                            <a href="#">
                                <i class="glyphicon glyphicon-align-left"></i> <span>{%$value.grade_name%}</span> <i class="fa fa-angle-left pull-right"></i>
                            </a>
                            <ul class="treeview-menu" style="background-color:#fff;">
                                {%foreach from=$value.class_name key=k item=v%}
                                <li {%if $k==$class_id%}class="active"{%/if%}><a href="index.php?a=score.folclass&class_id={%$k%}"><i class="fa fa-angle-right"></i>{%$v%}</a></li>
                                {%/foreach%}
                            </ul>
                        </li>
                        {%/foreach%}
                    </ul>
                </div>
            </section>
            <!--树状图结束-->
            <section class="col-lg-10 connectedSortable">
                <div class="box box-default box-solid">
                    <form action="" method="get">
                        <div class="box-header with-border">
                            <span class="fa fa-step-forward" style="float:left; font-size:18px; padding-top:3px; color:#3c8dbc;" ></span>
                            <p class="box-title">班成绩跟踪情况（平均分）</p>
                            <a href="" class="btn btn-warning btn-sm" style="float:right; color:#fff;">导 出</a>
                        </div>
                        <div class="box-body">
                            <div class="col-md-6 col-xs-12 form-group" style="padding:0;">
                                <label class="col-sm-1 control-label text-right">
                                    从
                                </label>
                                <div class="input-group col-md-5" style="float:left;">
                                    <select class="form-control" id="semester_id" name="semester_id1">
                                        <option value="0">-请选择-</option>
                                        {%foreach from=$semester_lists key=key item=value%}
                                        <option value="{%$value.semester_id%}">{%$value.semester_name%}</option>
                                        {%/foreach%}
                                    </select>
                                </div>
                                <span style="float:left; font-weight:bold;">  至 </span >
                                <div class="input-group col-md-5" >
                                    <select class="form-control" id="semester_id" name="semester_id2">
                                        <option value="0">-请选择-</option>
                                        {%foreach from=$semester_lists key=key item=value%}
                                        <option value="{%$value.semester_id%}">{%$value.semester_name%}</option>
                                        {%/foreach%}
                                    </select>
                                </div>
                            </div>
                            <div class="col-md-3 form-group">
                                <div class="input-group col-sm-8 col-xs-8" style="float:left; margin-right:8px;">
                                    <select class="form-control"  name="exam_type">
                                        {%foreach from=$exam_type_ini key=key item=value%}
                                        <option value="{%$key%}">{%$value%}</option>
                                        {%/foreach%}
                                        <option value="all">全部考</option>
                                    </select>
                                </div>
                                <input type="hidden" name="cid" value="{%$cid%}">
                                <input type="hidden" name="a" value="score.folclass">
                                <button type="submit" class="btn btn-primary">确 定</button>
                            </div>
                            <div style="clear:both; height:10px;"></div>
                            <div style="overflow-x:scroll; width:100%">
                                <table class="table table-bordered table-striped"  id="mytable">
                                    <thead>
                                    <tr>
                                        <td>班级</td>
                                        <td>学年学期</td>
                                        <td>考试</td>
                                        <td>总分</td>
                                        <td>优秀率</td>
                                        <td>排名</td>
                                        {%foreach from=$subject_lists key=key item=value%}
                                        <td>{%$value.subject_name%}</td>
                                        <td>排名</td>
                                        {%/foreach%}
                                    </tr>
                                    </thead>
                                    {%foreach from=$all key=key item=value%}
                                    <tr>
                                        <td>{%$student_data.class_name%}</td>
                                        <td>{%$value.sem%}</td>
                                        <td>{%$value.exam%}</td>
                                        <td>{%$value.score|string_format:"%.2f"%}</td>
                                        <td>优秀</td>
                                        <td>{%$value.rank%}</td>
                                        {%foreach from=$value.sub key=key item=v%}
                                        <td>{%$v.mysum|string_format:"%.2f"%}</td>
                                        <td>{%$v.rank%}</td>
                                        {%/foreach%}
                                    </tr>
                                    {%/foreach%}

                                </table>
                            </div>
                        </div><!--box-body -->
                        <div class="box-footer text-center">
                            <div class="chartContainer" style="height: 400px; width:90%;"></div>
                        </div>
                    </form>
                </div><!--box box-default box-solid-->
            </section>
        </div><!--row-->
    </section>
</div>
  <!--主要内容结束-->
{%include file="index.footer.tpl.php"%}

<script src="static/js/jquery.canvasjs.min.js"></script>
<script type="text/javascript">
    $(function () {
        $(".chartContainer").CanvasJSChart({
            title: {
                text: "班级总分趋势(平均分)",
                fontSize: 16
            },
            axisX: {
                gridColor: "Silver",
                tickColor: "silver",
                interval: 10,
            },
            toolTip: {
                shared: true
            },
            data: [
                {
                    showInLegend: true,
                    name: "总分平均分",
                    type: "line",
                    markerType: "square",
                    dataPoints: [
                        {%foreach from=$all key=key item=value name=foo%}

                        { x: {%$smarty.foreach.foo.iteration%}0, label: "{%$value.exam%}", y: {%$value.score%} },
                        {%/foreach%}
                    ]
                },
            ]
        });
    });
</script>
